package com.travelparadise.dao;

import java.util.Collection;
import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.travelparadise.domain.Commande;
import com.travelparadise.domain.Reservation;

public class CommandeDaoHibernate extends HibernateDaoSupport implements CommandeDao {

	@Override
	public Commande getById(int id) {
		HibernateTemplate hibernateTemplate = this.getHibernateTemplate();
		Commande commande = (Commande) hibernateTemplate.get(com.travelparadise.domain.Commande.class, id);
		return commande;
	}

	@Override
	public void addReservation(Reservation reservation) {
		// TODO Auto-generated method stub

	}

	@Override
	public Collection<Commande> findCommandesByIdClient(int idClient) {
		String reqHQL ="select c from Commande as c where c.client.id ="+idClient;
		return this.getHibernateTemplate().find(reqHQL);
	}

}
